import 'package:flutter/material.dart';

class HomeNav extends StatefulWidget {
  const HomeNav({super.key});

  @override
  State<HomeNav> createState() => _HomeNavState();
}

// 导航数据
List navList = [
  {'title': '我的房屋', 'icon': 'assets/images/house_nav_icon@2x.png'},
  {'title': '我的报修', 'icon': 'assets/images/repair_nav_icon@2x.png'},
  {'title': '访客登记', 'icon': 'assets/images/visitor_nav_icon@2x.png'},
];

class _HomeNavState extends State<HomeNav> {
  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(10),
        color: Colors.white,
      ),
      padding: const EdgeInsets.all(10),
      child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: navList.map((item) {
            return Column(
              children: [
                Image.asset(item['icon'], width: 32, height: 32),
                const SizedBox(height: 5),
                Text(item['title']),
              ],
            );
          }).toList()),
    );
  }
}
